package fourzerofour.guoshixu.day01;

import java.util.Scanner;

public class Question10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //假设正确密码为123
        int truePassword = 123;
        //用户输入的密码
        int password;
        //允许输入的最大次数
        int maxCount = 3;
        //当前次数
        int i = 1;
        do {
            //三次后程序退出。
            if(i>3){
                return;
            }
            System.out.println("请输入正确的密码 ："+ "(当前第" + i +"次输入,最多可输入3次，剩余" + (4-i) +"次机会)");
            password = scanner.nextInt();
            i++;
        }while (password!=123);

        System.out.println("输入正确！");
    }
}
